package com.guice.web.guice_webapp_example.mybatis.mapper;

import com.guice.web.guice_webapp_example.mybatis.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {
    @Select("SELECT * FROM user WHERE id = #{userId}")
    User getUser(@Param("userId") Integer userId);

    @Insert("INSERT INTO user (name,age,address) VALUES (#{name,jdbcType=VARCHAR},#{age,jdbcType = INTEGER},#{address,jdbcType=VARCHAR})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    Integer  save(User user);
}
